From 2d676f32b1043523c31db36f3ccbdefe09c5ad1a Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 22 Jan 2013 19:08:56 +0000 Subject: [PATCH] wayland: Handle the keymap being needed before we know about seats In the Wayland backend implementation for gdk_display_get_keymap we enumerate the known devices and look for an core keyboard device. These device objects are created when we receive the capabilities for the seat. The seat capabilities may be received after a request for the keymap so we handle this by creating a temporary keymap which we then free later when we have the real one. --- gdk/wayland/gdkdisplay-wayland.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index de3352566a..45e5d5af38 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -475,6 +475,7 @@ _gdk_wayland_display_get_keymap (GdkDisplay *display) GdkDeviceManager *device_manager; GList *list, *l; GdkDevice *core_keyboard = NULL; + static GdkKeymap *tmp_keymap = NULL; device_manager = gdk_display_get_device_manager (display); list = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER); @@ -491,7 +492,18 @@ _gdk_wayland_display_get_keymap (GdkDisplay *display) break; } - return core_keyboard?_gdk_wayland_device_get_keymap (core_keyboard):NULL; + if (core_keyboard && tmp_keymap) + { + g_object_unref (tmp_keymap); + tmp_keymap = NULL; + } + + if (core_keyboard) + return _gdk_wayland_device_get_keymap (core_keyboard); + + tmp_keymap = _gdk_wayland_keymap_new (); + + return tmp_keymap; } static void -- 2.30.2